--藏心何妨
local cangxinghefang = fk.CreateSkill {
    name = "mcdh_cangxinghefang",
}

local U = require "packages/utility/utility"
local lib = require "packages/mcdh/lib"

cangxinghefang:addEffect('active',{
    card_num = 1,
    card_min_num = 1 ,
    target_num = 1,
    can_use = function(self, player)
        return player:usedSkillTimes(self.name) == 0
    end,
    card_filter = function() return true end,
    target_filter = function(self, player,to_select, selected, selected_cards)
        return #selected == 0 and to_select ~= player
    end,
    on_use = function(self, room, effect)
        local target = effect.tos[1]
        local player =effect.from
        room:moveCards({
            ids = effect.cards ,
            from = player,
            to = target,
            toArea = Card.PlayerHand,
            moveReason = fk.ReasonGive,
            skillName =  self.name,
            moveVisible = false
        })
        room:damage({
            from = player,
            to = target,
            damage = 1,
            skillName = self.name,
        })
        local choices = {"cangxinghefang1:"..player.id,"cangxinghefang2:"..player.id}
        if  player:isNude() then
            table.removeOne(choices,"cangxinghefang1:"..player.id )
        end
        if not target.dead then
            local choice = room:askForChoice(target, choices, self.name, nil, nil,{"cangxinghefang1:"..player.id,"cangxinghefang2:"..player.id})
            if choice == "cangxinghefang1:"..player.id then
                local id = room:askForCardChosen(target, player, "he", self.name)
                room:throwCard(id,self.name, player,target)
            else
                player:drawCards(3,self.name)
            end
        end
    end
})

Fk:loadTranslationTable {
    ["mcdh_cangxinghefang"] = "藏心何妨",
    [":mcdh_cangxinghefang"] = "出牌阶段限一次，你可以将一张牌交给一名其他角色并对其造成1点伤害。然后其选择一项：1.弃置你一张牌；2.令你摸三张牌。",
    ["cangxinghefang1"] = "1.弃置 %src 一张牌",
    ["cangxinghefang2"] = "2.令 %src 摸三张牌",
}

return cangxinghefang